package cn.luischen;

import springfox.documentation.builders.RequestHandlerSelectors;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.Gson;
import springfox.documentation.builders.PathSelectors;
import org.springframework.context.annotation.Configuration;
import java.lang.reflect.Type;
import springfox.documentation.builders.ApiInfoBuilder;
import com.google.gson.JsonParseException;
import org.springframework.beans.factory.annotation.Value;
import com.google.gson.JsonElement;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.sql.Date;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import com.google.gson.JsonDeserializer;
import org.springframework.context.annotation.Bean;

import static org.junit.Assert.fail;
import org.mockito.MockitoAnnotations;
import org.junit.After;
import java.util.Map;
import java.lang.reflect.Method;
import static org.junit.Assert.*;
import java.util.List;
import com.alibaba.fastjson.TypeReference;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import org.powermock.reflect.Whitebox;
import org.mockito.Mock;
import org.junit.runner.RunWith;
import java.util.HashMap;
import java.util.ArrayList;
import com.alibaba.fastjson.JSONArray;
import org.powermock.core.classloader.annotations.PrepareForTest;
import static org.junit.Assert.assertEquals;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.junit.rules.ExpectedException;
import org.mockito.InjectMocks;
import org.junit.Test;
import com.unitspirit.runtime.*;
import org.mockito.Mockito;
import com.alibaba.fastjson.JSON;
import org.junit.Rule;
import static org.junit.Assert.assertTrue;
import com.alibaba.fastjson.parser.ParserConfig;

/**
* The class <code>Swagger2Test</code> contains tests for the class <code>{@link Swagger2}</code>.
* Copyright (c) 2020
* 
* @generatedBy UnitSpirit at 2021-09-07 17:51:25
* @version 1.0.20210903
*/

@PowerMockIgnore({ "javax.management.*" })
@RunWith(PowerMockRunner.class)
@PrepareForTest({ springfox.documentation.builders.ApiInfoBuilder.class })
public class Swagger2_apiInfo_WGTest {

	@Rule
	public ExpectedException unitspirit_thrown = ExpectedException.none();

	/**
	* 测试方法初始化.
	* 
	* @throws Exception 
	*         if the initialization fails for some reason 
	*  
	* @generatedBy UnitSpirit at 2021-09-07 17:51:25
	*/
	@org.junit.Before
	public void setUp() throws Exception {
		try {
			ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	/**
	* @date 2021-09-07 17:51:26
	* @see cn.luischen.Swagger2#apiInfo
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_apiInfo_0113_185940_563_1_0() throws Throwable {

		cn.luischen.Swagger2 unitspirit_fixture = new cn.luischen.Swagger2();
		//成员变量设置
		Whitebox.setInternalState(unitspirit_fixture, "swaggerShow", JSON.parseObject("true", Boolean.class));

		//返回值定义 
		String result_expected = "{\"contact\":\"Luis chen\",\"description\":\"更多Spring Boot相关文章请关注：https://luischen.com/\",\"termsOfServiceUrl\":\"https://luischen.com/\",\"title\":\"Luis Site Swagger Restful API\",\"version\":\"1.0\"}";

		springfox.documentation.builders.ApiInfoBuilder mock_sub_caller_ApiInfoBuilder7 = PowerMockito
				.mock(springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder6 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder5 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder4 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder3 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder2 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.service.ApiInfo mock_result_ApiInfo1 = UnitSpiritGsonUtil.getGson().fromJson(
				"{\"contact\":\"Luis chen\",\"description\":\"更多Spring Boot相关文章请关注：https://luischen.com/\",\"termsOfServiceUrl\":\"https://luischen.com/\",\"title\":\"Luis Site Swagger Restful API\",\"version\":\"1.0\"}",
				springfox.documentation.service.ApiInfo.class);

		PowerMockito.whenNew(springfox.documentation.builders.ApiInfoBuilder.class).withNoArguments()
				.thenReturn(mock_sub_caller_ApiInfoBuilder7);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.title(anyString())).thenReturn(mock_result_ApiInfoBuilder6);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.description(anyString()))
				.thenReturn(mock_result_ApiInfoBuilder5);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.termsOfServiceUrl(anyString()))
				.thenReturn(mock_result_ApiInfoBuilder4);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.contact(anyString())).thenReturn(mock_result_ApiInfoBuilder3);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.version(anyString())).thenReturn(mock_result_ApiInfoBuilder2);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.build()).thenReturn(mock_result_ApiInfo1);

		springfox.documentation.service.ApiInfo unitspirit_result = Whitebox.invokeMethod(unitspirit_fixture,
				"apiInfo");
		UnitAssert.assertEquals(result_expected, UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
	}

	/**
	* @date 2021-09-07 17:51:26
	* @see cn.luischen.Swagger2#apiInfo
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_apiInfo_0220_170540_658_1_0() throws Throwable {

		cn.luischen.Swagger2 unitspirit_fixture = new cn.luischen.Swagger2();
		//成员变量设置
		Whitebox.setInternalState(unitspirit_fixture, "swaggerShow", JSON.parseObject("true", Boolean.class));

		//返回值定义 
		String result_expected = "{\"contact\":\"Luis chen\",\"description\":\"更多Spring Boot相关文章请关注：https://luischen.com/\",\"termsOfServiceUrl\":\"https://luischen.com/\",\"title\":\"Luis Site Swagger Restful API\",\"version\":\"1.0\"}";

		springfox.documentation.builders.ApiInfoBuilder mock_sub_caller_ApiInfoBuilder7 = PowerMockito
				.mock(springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder6 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder5 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder4 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder3 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder2 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.service.ApiInfo mock_result_ApiInfo1 = UnitSpiritGsonUtil.getGson().fromJson(
				"{\"contact\":\"Luis chen\",\"description\":\"更多Spring Boot相关文章请关注：https://luischen.com/\",\"termsOfServiceUrl\":\"https://luischen.com/\",\"title\":\"Luis Site Swagger Restful API\",\"version\":\"1.0\"}",
				springfox.documentation.service.ApiInfo.class);

		PowerMockito.whenNew(springfox.documentation.builders.ApiInfoBuilder.class).withNoArguments()
				.thenReturn(mock_sub_caller_ApiInfoBuilder7);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.title(anyString())).thenReturn(mock_result_ApiInfoBuilder6);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.description(anyString()))
				.thenReturn(mock_result_ApiInfoBuilder5);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.termsOfServiceUrl(anyString()))
				.thenReturn(mock_result_ApiInfoBuilder4);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.contact(anyString())).thenReturn(mock_result_ApiInfoBuilder3);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.version(anyString())).thenReturn(mock_result_ApiInfoBuilder2);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.build()).thenReturn(mock_result_ApiInfo1);

		springfox.documentation.service.ApiInfo unitspirit_result = Whitebox.invokeMethod(unitspirit_fixture,
				"apiInfo");
		UnitAssert.assertEquals(result_expected, UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
	}

	/**
	* @date 2021-09-07 17:51:26
	* @see cn.luischen.Swagger2#apiInfo
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_apiInfo_20210222_200453_542_1_0() throws Throwable {

		cn.luischen.Swagger2 unitspirit_fixture = new cn.luischen.Swagger2();
		//成员变量设置
		Whitebox.setInternalState(unitspirit_fixture, "swaggerShow", JSON.parseObject("true", Boolean.class));

		//返回值定义 
		String result_expected = "{\"contact\":\"Luis chen\",\"description\":\"更多Spring Boot相关文章请关注：https://luischen.com/\",\"termsOfServiceUrl\":\"https://luischen.com/\",\"title\":\"Luis Site Swagger Restful API\",\"version\":\"1.0\"}";

		springfox.documentation.builders.ApiInfoBuilder mock_sub_caller_ApiInfoBuilder7 = PowerMockito
				.mock(springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder6 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder5 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder4 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder3 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.builders.ApiInfoBuilder mock_result_ApiInfoBuilder2 = JSON.parseObject("{}",
				springfox.documentation.builders.ApiInfoBuilder.class);
		springfox.documentation.service.ApiInfo mock_result_ApiInfo1 = UnitSpiritGsonUtil.getGson().fromJson(
				"{\"contact\":\"Luis chen\",\"description\":\"更多Spring Boot相关文章请关注：https://luischen.com/\",\"termsOfServiceUrl\":\"https://luischen.com/\",\"title\":\"Luis Site Swagger Restful API\",\"version\":\"1.0\"}",
				springfox.documentation.service.ApiInfo.class);

		PowerMockito.whenNew(springfox.documentation.builders.ApiInfoBuilder.class).withNoArguments()
				.thenReturn(mock_sub_caller_ApiInfoBuilder7);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.title(anyString())).thenReturn(mock_result_ApiInfoBuilder6);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.description(anyString()))
				.thenReturn(mock_result_ApiInfoBuilder5);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.termsOfServiceUrl(anyString()))
				.thenReturn(mock_result_ApiInfoBuilder4);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.contact(anyString())).thenReturn(mock_result_ApiInfoBuilder3);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.version(anyString())).thenReturn(mock_result_ApiInfoBuilder2);
		PowerMockito.when(mock_sub_caller_ApiInfoBuilder7.build()).thenReturn(mock_result_ApiInfo1);

		springfox.documentation.service.ApiInfo unitspirit_result = Whitebox.invokeMethod(unitspirit_fixture,
				"apiInfo");
		UnitAssert.assertEquals(result_expected, UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
	}
}
